package kr.pe.johnkim.app.mobile.rest.service;

import kr.pe.johnkim.app.domain.MyHistoryCategory;
import kr.pe.johnkim.app.domain.MyHistoryItem;
import kr.pe.johnkim.app.mobile.rest.dao.MyHistoryCategoryDao;
import kr.pe.johnkim.app.mobile.rest.dao.MyHistoryCategoryDaoImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * @author : johnkim <cale9797@gmail.com / Bettersoft Inc,.>
 * @Date : 12. 2. 1
 */
public class MyHistoryCategoryServiceImpl implements MyHistoryCategoryService {
    // SLF4J Logging
	private Logger logger = LoggerFactory.getLogger(MyHistoryCategoryServiceImpl.class);

    /**
     * 카테고리 중복을 확인 한다.
     *
     * @param myHistoryCategory
     * @return MyHistoryCategory
     */
    @Override
    public MyHistoryCategory checkDuplication(MyHistoryCategory myHistoryCategory) {
        logger.info("checkDuplication");
        return myHistoryCategoryDao.checkDuplication(myHistoryCategory);
    }

    /**
     * 카테고리를 등록 한다.
     *
     * @param myHistoryCategory
     * @return True or False
     */
    @Override
    public boolean registerCategory(MyHistoryCategory myHistoryCategory) {
        logger.info("registerCategory");
        return myHistoryCategoryDao.registerCategory(myHistoryCategory);
    }

    /**
     * 카테고리 목록을 가져 온다.
     *
     * @param myHistoryCategory
     * @return List<MyHistoryCategory>
     */
    @Override
    public List<MyHistoryCategory> selectCategoryList(MyHistoryCategory myHistoryCategory) {
        logger.info("selectCategoryList");
        return myHistoryCategoryDao.selectCategoryList(myHistoryCategory);
    }

    /**
     * 카테고리 전체 갯수를 가져 온다.
     *
     * @param myHistoryCategory
     * @return MyHistoryCategory
     */
    @Override
    public MyHistoryCategory selectCategoryCount(MyHistoryCategory myHistoryCategory) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    /**
     * 카테고리 상세 정보를 가져 온다.
     *
     * @param myHistoryCategory
     * @return MyHistoryCategory
     */
    @Override
    public MyHistoryCategory selectCategory(MyHistoryCategory myHistoryCategory) {
        logger.info("selectCategory");
        return myHistoryCategoryDao.selectCategory(myHistoryCategory);
    }

    /**
     * 카테고리 내용을 수정 한다.
     *
     * @param myHistoryCategory
     * @return True or False
     */
    @Override
    public boolean updateCategory(MyHistoryCategory myHistoryCategory) {
        logger.info("updateCategory");
        return myHistoryCategoryDao.updateCategory(myHistoryCategory);
    }

    /**
     * 카테고리를 비 활성화 한다.
     *
     * @param myHistoryCategory
     * @return True or False
     */
    @Override
    public boolean updateDeactivateCategory(MyHistoryCategory myHistoryCategory) {
        logger.info("updateDeactivateCategory");
        return myHistoryCategoryDao.updateDeactivateCategory(myHistoryCategory);
    }

    /**
     * 카테고리를 즐겨 찾기에서 등록 한다.
     *
     * @param myHistoryCategory
     * @return True or False
     */
    @Override
    public boolean updateFavoriteCategory(MyHistoryCategory myHistoryCategory) {
        logger.info("updateFavoriteCategory");
        return myHistoryCategoryDao.updateFavoriteCategory(myHistoryCategory);
    }

    /**
     * 카테고리를 즐겨 찾기에서 등록 해제 한다.
     *
     * @param myHistoryCategory
     * @return True or False
     */
    @Override
    public boolean updateDeactivateFavoriteCategory(MyHistoryCategory myHistoryCategory) {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

    /**
     * Category Analysis 화면에서 출력할 item 목록을 가져 온다.
     *
     * @param myHistoryItem
     * @return List<MyHistoryItem>
     */
    @Override
    public List<MyHistoryItem> selectItemListForCategoryAnalysis(MyHistoryItem myHistoryItem) {
        logger.info("selectItemListForCategoryAnalysis");
        return myHistoryCategoryDao.selectItemListForCategoryAnalysis(myHistoryItem);
    }

    /**
     * Group 의 Category 목록을 가져 온다.
     * 
     * 비활성의 목적으로 사용 한다.
     *
     * @param myHistoryCategory
     * @return
     */
    @Override
    public List<MyHistoryCategory> selectCategoryListForGroup(MyHistoryCategory myHistoryCategory) {
        logger.info("selectCategoryListForGroup");
        return myHistoryCategoryDao.selectCategoryListForGroup(myHistoryCategory);
    }

    /**
     * Spring Setter Injection.
     */
    private MyHistoryCategoryDao myHistoryCategoryDao;

    public void setMyHistoryCategoryDao(MyHistoryCategoryDaoImpl myHistoryCategoryDao) {
        this.myHistoryCategoryDao = myHistoryCategoryDao;
    }
}
